﻿{extends file="admin/layout.tpl"}

{block name="title"}##NA_PESONAL_INFO##{/block}

{block name="script"}
	$(document).ready(function () {
	
	$('table#accounts td a.lock').click(function()
    {
        if (confirm("Bạn muốn khóa tài khoản này?"))
        {
            var id = $(this).parent().parent().attr('id');
            var data = 'id=' + id +'&action=lock';
            var url = 'account.php?'+data;
			window.location.href = url;
        }
    });
	
	$('table#accounts td a.activate').click(function()
    {
        if (confirm("Bạn muốn kích hoạt tài khoản này?"))
        {
            var id = $(this).parent().parent().attr('id');
            var data = 'id=' + id +'&action=activate';
            var url = 'account.php?'+data;
			window.location.href = url;
        }
    });
	
	});
{/block}

{block name="name"}
	Quản lý tài khoản
{/block}

{block name="content"}
	<div class="message {$type_message|default:'error'}" style="display:{$is_display|default:'none'};">{$message|default:''}</div>
    <div class="clear">
	</div>
	
	<div class="box round first center">
		<h2>Danh sách tài khoản</h2>
		
		<table class="data display datatable" id="accounts" name="accounts">
            <thead>
                <tr>
                    <td bgcolor="#FFFFFF"><strong>
                        Mã tài khoản
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        Tên đăng nhập
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        Họ tên
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        Đã kích hoạt
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        Khóa tài khoản/Kích hoạt
                    </strong></td>
                </tr>
            </thead>
            
            <tbody>
            {foreach $accounts|default:array() as $i}
                <tr id="{$i.Ma}">        
                    <td>
						{$i.Ma}
					</td>
                    <td>
                        <a href="">{$i.Email}</a>
                    </td>
                    <td>
                        {$i.HoTen}
                    </td>
                    <td align="center">
                        {if $i.KichHoat==1}
                            <img src="{$wwwUrl|default:''}img/check.png"/>
                            {else}
                            <img src="{$wwwUrl|default:''}img/block.png"/>
                            {/if}
                    </td>
                    
					
					{if $i.KichHoat == 1}
						<td align="center"><a href="#" class="lock">Khóa</a></td>
					{else}
						<td align="center"><a href="#" class="activate">Kích hoạt</a></td>
					{/if}
					
                </tr>            
                    
               
            {/foreach}
            </tbody> 
        </table>
            <ul id="pagination-flickr">
		{if $page_current|default:1 == 1}
			<li class="previous-off">« Previous</li>
		{else}
			<li class="previous"><a href="?page={$page_current - 1}">« Previous</a></li>
		{/if}
		
		{if $page_current <= 3}
			{for $i = 1 to $page_count max=5}
				{if $i == $page_current}
					<li class="active">{$i}</li>
				{else}
					<li><a href="?page={$i}">{$i}</a></li>
				{/if}
			{/for}	
		{else}
			{for $i = -2 to 2}
				{if $page_current + $i <= $page_count}
					{if $page_current + $i == $page_current}
						<li class="active">{$page_current}</li>
					{else}
						<li><a href="?page={$page_current + $i}">{$page_current + $i}</a></li>
					{/if}
				{/if}
			{/for}
		{/if}
		
		{if $page_current == $page_count}
			<li class="next-off">Next »</li>
		{else}
			<li class="next"><a href="?page={$page_current + 1}">Next »</a></li>
		{/if}
	</ul> 
	</div>
	<div class="clear">
        </div>	
	
	
	
{/block}